package org.itboys.core.util.SMS;

import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

/**
 * 作者：zzq
 * 时间：2018/11/1
 * 描述：江南布衣发送验证码
 */
public class JNBYSMSUtil {

    public static void sundaySendSms(String mobile,String code) throws IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost post = new HttpPost("http://106.ihuyi.cn/webservice/sms.php?method=Submit&account=cf_mylaugh&password=snowfox&mobile="+mobile+"&content=您的短信验证码为:"+code+"。欢迎访问江南布衣官方微信，请在会员卡页面填入该验证码。");
        HttpResponse response = client.execute(post);
    }

    public static void main(String[] args) throws IOException {
        String mobile="13755759454";
        String code="5858";
        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost post = new HttpPost("http://106.ihuyi.cn/webservice/sms.php?method=Submit&account=cf_mylaugh&password=snowfox&mobile="+mobile+"&content=您的短信验证码为:"+code+"。欢迎访问江南布衣官方微信，请在会员卡页面填入该验证码。");
        HttpResponse response = client.execute(post);
        HttpEntity entity = response.getEntity();
        String result = EntityUtils.toString(entity, "UTF-8");
        System.out.println(result);


    }
}
